package cn.kxhp.mybatis3.controller;

import cn.kxhp.mybatis3.pojo.UserRoleDTO;
import cn.kxhp.mybatis3.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Lianxw
 * @since 2022/3/29
 */
@RestController
public class DemoController {
    private final UserService userService;


    public DemoController(UserService userService) {
        this.userService = userService;
    }

    @GetMapping("userWithRole")
    public List<UserRoleDTO> queryUserWithRole() {
        return userService.queryAllUserAndRoles();
    }
}
